﻿@using ECG.Common
@using ECG.Utility
@using ECG.WebUI.CustomHelpers
@using ECG.WebUI.Models
@model IEnumerable<ProductRateByCateTopListPagingDto>
@{
    ViewBag.Title = "Sản phẩm thuộc thương hiệu " + ViewBag.ProviderName;
    Layout = "~/Views/Shared/_LayoutHideCate.cshtml";
}
<div class="layout-width">
    @*@Html.Action("Adv1ByCategory", "CategoryL1", new { category = Model.Id, w = 980, o = 0 })*@
    <div class="cate-page-box clearfix">
        <div class="cate-left-box fl">
            <div class="cate-list">
                @*@Html.Action("CategoryMenuLeftAll", "Category")*@
            </div>
        </div>
        <div class="cate-right-box fl">
            <div class="Category-p-list">
                <div class="textTotalProduct">
                    <h1 class="h-l3">@ViewBag.CateName</h1>                   
                </div>
                <div class="cate-box-codition clearfix">
                    <div class="box-co-left fl">
                        <ul class="litsCo ul">
                            <li>
                                <span class="coFirst-text">Xem theo</span>
                            </li>
                            <li>
                                <a href="javascript:void(0);" rel="nofollow">tất cả</a>
                            </li>
@*                            <li>
                                <a href="javascript:void(0);" rel="nofollow">bán chạy</a>
                            </li>
                            <li>
                                <a href="javascript:void(0);" rel="nofollow">giảm giá</a>
                            </li>*@
                        </ul>
                    </div>
                    <div class="box-co-right fl">
                        <div class="coWrap">
                            @*<span class="coText">Hiển thị</span>
                            <a href="javascript:void(0);" rel="nofollow" class="sortCol sortCol-ac"></a>
                            <a href="javascript:void(0);" rel="nofollow" class="sortGrid sortGrid-ac"></a>*@
                            <span class="coText2">Sắp xếp</span>
                            @Html.DropDownList("selectSortCategory", new SelectList(CommonHelpers.selectSortCategory(), "Value", "Text", ViewBag.Fillter), new { @Class = "sortDrop" })
                        </div>
                    </div>
                </div>
                @{
                    if (Model.Any())
                    {
                    <div class="CoListProduct">
                        <ul class="listp ul clearfix">
                            @foreach (var item in Model)
                            {
                                var pDetailLink = Url.Action("Index", "ProductDetail", new { productId = item.Id, productName = StringUtil.RemoveSpecialCharactersVn(item.Name) });
                                <li>
                                    <div class="pItem">
                                        <a href="@pDetailLink" class="pItem-lnkImg">
                                            @if (item.PromotionPrice > 0)
                                            {
                                                <span class="pItem-per">-@item.DiscountPercentage.ToString("#.#")<i>%</i></span>
                                            }
                                            <img src="@item.ImagePath.ImagePathThumb(135, 135)" width="135" height="135" alt="@item.Name">
                                        </a>
                                        <div class="pItem-info">
                                            <div style="line-height: 13px; margin-top: 5px;">
                                                @{
                                            string StarPercent = "0";
                                            if (item.AverageRate > 0)
                                            {
                                                StarPercent = (Convert.ToDouble(item.AverageRate) * 100 / 5).ToString("#.#").Replace(',', '.');
                                            }
                                                }
                                                <span class="itm-ratStars inlineBlocka"><span style="width: @StarPercent%;" class="itm-ratStars itm-ratRating"></span></span>
                                            </div>
                                            <h6>
                                                <a href="@pDetailLink">@item.Name</a>
                                            </h6>
                                            @if (item.PromotionPrice > 0)
                                            {
                                                <p class="pItem-PriceOld">
                                                    @item.Price.ToString("##,###,###") đ
                                                </p>
                                                <p class="pItem-PriceNew">
                                                    @item.PromotionPrice.ToString("##,###,###") <strong>đ</strong>
                                                    <a href="javascript:void(0);" class="fbComment">Bình luận</a>
                                                </p>
                                            }
                                            else
                                            {
                                                <p class="pItem-PriceNew">
                                                    @item.Price.ToString("##,###,###") <strong>đ</strong>
                                                    <a href="javascript:void(0);" class="fbComment">Bình luận</a>
                                                </p>
                                            }

                                        </div>
                                    </div>
                                </li>
                            }
                        </ul>
                    </div>
                    }
                }
                <div class="bb_pagging">
                @Html.PageLinksOnProductListCatePage((PageInfo)ViewBag.PageInfo, i => Url.Action("Index", "ProductByProvider", new { page = i }))
            </div>
            </div>
        </div>
    </div>
</div>

